#ifndef SELFWIKI_H
#define SELFWIKI_H

#include "wiki.h"


#include <QWebEngineUrlRequestInterceptor>
class SelfWikiInterceptor : public QWebEngineUrlRequestInterceptor {

    // QWebEngineUrlRequestInterceptor interface
public:
    void interceptRequest(QWebEngineUrlRequestInfo &info) override;

    QStringList blockUrls() const;
    void setBlockUrls(const QStringList &newBlockUrls);
    void setBlockUrls(const QString &newBlockUrls);

private:
    QStringList m_blockUrls;
};

class SelfWiki : public Wiki
{
public:
    SelfWiki();

    // Wiki interface
public:
    virtual QString name() override;

    // Wiki interface
public:
    WIKI_AUTOLOAD
    WIKI_USE_LIST
    virtual QList<QListWidgetItem *> searching_item(const QString &text) override;
    virtual QString content_item(const QListWidgetItem *item) override;

    // Wiki interface
public:
    virtual bool interactive(const QString &text) override;
    virtual bool interactive_running() override;
    virtual void interactive_restore() override;

private:
    QString m_key;
    QVariantMap m_map;

    SelfWikiInterceptor m_interceptor;

    // Wiki interface
public:
    virtual ContentMode contentMode() override;
    virtual void content_item(const QListWidgetItem *item, QWebEngineView *view) override;

private:
    bool plugin_default;
};

#endif // SELFWIKI_H
